<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>报关单登记系统</title>
<!--#include file="lib/plugins.asp"-->
<script type="text/javascript" src="lib/jquery.jsonp-2.4.0.min.js"></script>
<style type="text/css">
  .ui-datepicker table {
    border: 0;
  }
  .ui-autocomplete-loading { 
    background: white url('images/ui-anim_basic_16x16.gif') left center no-repeat; 
  }
  .ui-autocomplete,.ui-menu-item .ui-corner-all {
      border-radius: 0;
  }
  thead th{
    #text-align:center;
    background:#e0e0e0;
  }
  #dv_content th[scope="col"]{
    background:#ffffff;
  }
  tbody th[scope="row"],tbody th.sub{
    text-align:center;
  }
  input,select{
    border:1px solid #888888;
  }
  input:hover,input:active,select:hover,select:active{
    border:1px solid #aa6666
  }
  input[type=text]{
    padding:2px;
    margin:1px 0;
  }
  #pagebar{
    float:right;
  }
  #search_bar{
    border-width:1px 0;
  }
  #search_bar td{
    padding:1px;
    border-width:0;
  }
  #search_bar tr:hover td{
    background:#fff;
  }
  .bt_button{
    cursor: pointer;
    overflow: visible;
    width: auto;
    background: url("lib/yaml/screen/images/button_gray.png") repeat-x scroll left top #454545;
    border-color: #DDDDDD #444444 #444444 #DDDDDD;
    border-style: solid;
    border-width: 1px;
    color: #000000;
    padding: 5px 1em;
  }
  .bt_button:hover,.bt_button:active,.bt_button:focus{
    background: none repeat-x scroll left top #555555;
    border-color: #444444 #DDDDDD #DDDDDD #444444;
    color: #ffffff;
  }


  #lb_search{
    width:5.1em;
  }
  #bts_search{
    width:11.9em;
    text-align:right;
  }
/* select class */

    .sel{
      color:red;
    }
    .unsel{
      color:black;
    }
  
/* // select class */


    .qb{
        width:15em;
        display:inline-block;
        
    }

</style>

<script type="text/javascript">
$(function() {
    /*
    $.ajaxSetup ({
        cache: false, //关闭AJAX相应的缓存
        beforeSend:function() {
            $("#search_bar .ui-widget").addClass( "ui-autocomplete-loading" );
            $("#bt_search").attr("disabled",true);
        },
        complete:function() {
            $("#search_bar .ui-widget").removeClass( "ui-autocomplete-loading" );
            $("#bt_search").attr("disabled",false);
        }
    });
    */
    $("#fm_search").submit(function(e){
        e.preventDefault(); 
        $("#bt_search").trigger("click");
    });
    $("#fm_search select").change(function(){
        $("#bt_search").trigger("click");
    });
    $("#search_bar input[type=reset]").click(function(){
      $("#search_bar select").removeClass("sel")
        .children().removeClass("unsel");
    });
    
    function showdata(json){
        $table=$("<table>");
        $table.addClass("full");
        $thead=$("<thead>");
        $tbody=$("<tbody>");
        $tr=$("<tr>");
        $th=$("<th>");
        $th.attr({
            colspan:json["col"],
            scope:"col"
        }).text(json["id"]+"."+json["name"]).appendTo($tr);
        $tr.appendTo($thead);
        for(var i=0;i<json["result"].length;i++){
            $tr=$("<tr>");
            if(i==0){
                for(var j=0;j<json["result"][i].length;j++){
                    
                    $tr.append($("<th>").text(json["result"][i][j]));
                    
                }
                $tr.appendTo($thead);
            }else{
                for(var j=0;j<json["result"][i].length;j++){
                    
                   
                    $tr.append($("<td>").text(json["result"][i][j]));
                    
                }
                $tr.appendTo($tbody);
            }
            
        }
        $thead.appendTo($table);
        $tbody.appendTo($table);
        $table.appendTo("#dv_content");
    }
    
    function doajax(ctn_no,query_id){
        $.jsonp({
            type:"get",
            url:"http://"+window.location.hostname+":50003/query_npedi",
            //callback:"callback",
            callbackParameter:"callback",
            //dataType:"jsonp",
            data:{
                "ctn_no":ctn_no,
                "query_id":query_id
            },
            beforeSend:function(){
                $("#search_bar .ui-widget").addClass( "ui-autocomplete-loading" );
                $("#bt_search").attr("disabled",true);
            },
            error:function(){
                $("#search_bar .ui-widget").removeClass( "ui-autocomplete-loading" );
                $("#bt_search").attr("disabled",false);
            },
            complete:function(){
                $("#search_bar .ui-widget").removeClass( "ui-autocomplete-loading" );
                $("#bt_search").attr("disabled",false);
            },
            success:function(json){
                //console.log(json);
                //console.log(json[0].g_name);
                //console.log(json.length);
                showdata(json);
                
            }
        });
    }
    
    
    $("#bt_search").click(function(e){
        $("#dv_content").html("");
        if($("#ctn_no").val()!=""){
            if($(".query_id:checked").length>3){
                alert("最多同时查询3个内容，请减少");
            }else{
                $(".query_id:checked").each(function(i,e){
                    doajax($("#ctn_no").val(),$(this).val());
                });
            }
        }
    });


});
</script>
<!--#include file="lib/js-google-analytics.asp"-->
</head>
<%
If Not CheckFlag(session("aaPostFlag"),1) Then Call JumpErrorPage(2)
%>
<body>
<!--#include file="lib/header.asp"-->
<!--#include file="lib/nav.asp"-->
<div id="main">

<!--#include file="lib/col1.asp"-->
<!--#include file="lib/col2.asp"-->
    <div id="col3">
        <div id="col3_content" class="clearfix">
            <form id="fm_search" name="fm_search">
                <table id="search_bar" class="full">
                  <tr>
                    <td id="lb_search">
                        <label for="ctn_no">集装箱号：</label>
                    </td>
                    <td>
                      <div>
                        <input id="ctn_no" name="ctn_no" type="text" size="11" />
                      </div>
                    </td>
                    <td>
                        <%
                          aNpediKey=dNpedi.keys
                          aNpediItem=dNpedi.items
                          for iNpediLoop=0 to dNpedi.count-1
                            if aNpediKey(iNpediLoop)<>2 and aNpediKey(iNpediLoop)<>3 then
                        %>
                      <span class="qb">
                          <input type="checkbox" class="query_id" name="query_id" value="<%=aNpediKey(iNpediLoop)%>"><%=aNpediKey(iNpediLoop)%>.<%=aNpediItem(iNpediLoop)%></option>
                      </span>
                        <%
                            end if
                          next
                        %>
                    </td>
                    <td id="bts_search">
                      <div class="ui-widget">
                      <input id="bt_search" class="bt_button" name="bt_submit" type="button" value="搜索" />
                      <input class="bt_button" type="reset" value="重置" />
                      </div>
                    </td>
                  </tr>
                </table>
            </form>
            <div id="dv_content"></div>
        </div>
    </div>
</div>
<!--#include file="lib/footer.asp"-->
</body>
</html>
<!--#include file="lib/connclose.asp"-->

